package com.ht.module.common.controller;


import com.ht.module.common.service.CommonService;
import com.ht.module.sys.service.SysDictService;
import com.ht.util.JsonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


/**
 * @ProjectName: ht
 * @ClassName: commonController
 * @Author: hejialun
 * @Description: 公共类的控制器
 * @Date: 2021/9/14 15:50
 */
@RestController
@RequestMapping("/common")
@Tag(name = "公共类控制器 ")
public class CommonController {
    @Autowired
    private CommonService commonService;
    @Autowired
    private SysDictService sysDictService;

    @Operation(summary = "查询码表")
    @GetMapping("/getItem/{code}")
    public JsonResult getItem(@PathVariable String code) {
        return JsonResult.success(sysDictService.getItem(code));
    }


    @Operation(summary = "文件上传")
    @PostMapping("/uploadFile")
    public JsonResult uploadFile(@RequestParam("file") MultipartFile file) {
        return JsonResult.success(commonService.uploadFile(file));
    }

}